WIDTH = 300
HEIGHT = 300

BACK_COLOR = (0, 0, 127)
CIRCLE_COLOR = (0, 200, 0)

x = 0
y = 100
r = 100
s = 2
def on_key_down(key):
    if key == keys.ESCAPE:
        quit()
        
def on_mouse_down(pos):
    print("mouse_down", pos)
    
def on_mouse_up(pos):
    print("mouse_up", pos)
    
def draw_circle(x, y, r):
    screen.draw.filled_circle((x, y), r, CIRCLE_COLOR)
    return 1
    
def update():
    global x
    global s
    x += s
    if (s > 0 and x + r > WIDTH) or (s < 0 and x - r < 0):
        s *= -1
        
def draw():
    screen.clear()
    screen.fill(BACK_COLOR)
    draw_circle(x, y, r)

